package iosr11.data;


import java.util.Calendar;
import java.util.Date;

import com.google.gdata.data.DateTime;

public class Mark extends Entity{
	private float grade;
	private Teacher teacher;
	private Student student;
	private MarkKind kind;
	private Date date;
	private float points;
	
	public Mark(){
		
	}
	
	public Mark(float grade, Teacher teacher, Student student, int kind, DateTime date, float points, String markId){
		super(markId);
		this.grade = grade;
		this.teacher = teacher;
		this.student = student;
		this.kind = this.changeIntToMarkKind(kind);
		this.date = new Date(date.getValue());
		this.points = points;
	}
	
	public int changeMarkKindToInt(MarkKind kind){
		return MarkKind.returnInt(kind);
	}
	
	public MarkKind changeIntToMarkKind(int kind){
		return MarkKind.returnMarkKind(kind);
	}
	
	public float getGrade() {
		return grade;
	}
	public void setGrade(float grade) {
		this.grade = grade;
	}
	public Teacher getTeacher() {
		return teacher;
	}
	public void setTeacher(Teacher teacher) {
		this.teacher = teacher;
	}
	public Student getStudent() {
		return student;
	}
	public void setStudent(Student student) {
		this.student = student;
	}
	public MarkKind getKind() {
		return kind;
	}
	public void setKind(MarkKind kind) {
		this.kind = kind;
	}
	public Date getDate() {
		return date;
	}
	public DateTime getGDate() {
		DateTime result = new DateTime();
		result.setValue(date.getTime());
		return result;
	}
	public void setDate(DateTime date) {
		this.date = new Date(date.getValue());
	}
	public void setDate(Date date) {
		this.date = date;
	}
	public float getPoints() {
		return points;
	}
	public void setPoints(float points) {
		this.points = points;
	}
	
	public String toString(){
		StringBuffer buf = new StringBuffer();
		buf.append("Id: "+this.getId());
		buf.append("\n");
		buf.append("Teacher: "+teacher.getId());
		buf.append("\n");
		buf.append("Student: "+student.getId());
		buf.append("\n");
		buf.append("Grade: "+grade);
		buf.append("\n");
		buf.append("Kind: "+kind);
		buf.append("\n");
		buf.append("Points: "+points);
		buf.append("\n");
		buf.append("Date: "+date);
		buf.append("\n");
		return buf.toString();
	}
	
}

